package com.eis.persist.dao.util;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

import com.eis.function.out.rule.StatusRuleResult;

public class FunctionTimeSetter implements BatchPreparedStatementSetter {
	private List<StatusRuleResult> ruleResult;
	
	public FunctionTimeSetter(List<StatusRuleResult> ruleResult) {
		this.ruleResult = ruleResult;
	}
	@Override
	public void setValues(PreparedStatement ps, int i) throws SQLException {
		ps.setTimestamp(1, new Timestamp(ruleResult.get(i).getTimestamp().getTime()));
		ps.setString(2, ruleResult.get(i).getStatus());
		ps.setInt(3, ruleResult.get(i).getEissysmainid());
	}

	@Override
	public int getBatchSize() {
		return ruleResult.size();
	}

}
